package 笔试真题;

import java.util.Arrays;

public class Qianxin1 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(getFraction(0.3f)));
    }

    public static int[] getFraction(float a) {
        // write code here
        float pp = 1.0f;
        int f = 0, m = 0;
        for (int i = 1; i < 200; i++) {
            float p = i / a;
            float v = p - (int) p;
            if ((int) p >= 200) break;
            if (v < pp) {
                f = i;
                m = (int) p;
                pp = v;
            }
        }
        int[] ints = new int[2];
        ints[0] = f;
        ints[1] = m;
        return ints;
    }
}
